<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  

  
  <title>备忘录</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="第二篇JDK的安装centOS下jdk安装与配置 Quick Start1. 下载JDK123先查看Linux系统是多少位（32位/64位）：getconf  LONG_BIT。再从JDK官网（http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html）下载JDK 7，Linux 64位下">
<meta property="og:type" content="article">
<meta property="og:title" content="备忘录">
<meta property="og:url" content="http://yoursite.com/2018/04/15/第二篇JDK的安装/index.html">
<meta property="og:site_name" content="备忘录">
<meta property="og:description" content="第二篇JDK的安装centOS下jdk安装与配置 Quick Start1. 下载JDK123先查看Linux系统是多少位（32位/64位）：getconf  LONG_BIT。再从JDK官网（http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html）下载JDK 7，Linux 64位下">
<meta property="og:locale" content="default">
<meta property="og:updated_time" content="2018-04-15T08:29:08.725Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="备忘录">
<meta name="twitter:description" content="第二篇JDK的安装centOS下jdk安装与配置 Quick Start1. 下载JDK123先查看Linux系统是多少位（32位/64位）：getconf  LONG_BIT。再从JDK官网（http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html）下载JDK 7，Linux 64位下">
  
    <link rel="alternate" href="/atom.xml" title="备忘录" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">备忘录</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-第二篇JDK的安装" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2018/04/15/第二篇JDK的安装/" class="article-date">
  <time datetime="2018-04-15T08:10:22.264Z" itemprop="datePublished">2018-04-15</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h2 id="第二篇JDK的安装"><a href="#第二篇JDK的安装" class="headerlink" title="第二篇JDK的安装"></a>第二篇JDK的安装</h2><p>centOS下jdk安装与配置</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="1-下载JDK"><a href="#1-下载JDK" class="headerlink" title="1. 下载JDK"></a>1. 下载JDK</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">先查看Linux系统是多少位（32位/64位）：getconf  LONG_BIT。再从JDK官网</span><br><span class="line">（http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html）</span><br><span class="line">下载JDK 7，Linux 64位下载jdk-7u60-linux-x64.tar.gz。</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/writing.html" target="_blank" rel="noopener">Writing</a></p>
<h3 id="2-解压安装"><a href="#2-解压安装" class="headerlink" title="2. 解压安装"></a>2. 解压安装</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">2.1选择安装JDK的位置/usr/java，如果存在这个目录无需创建，一般新到的机器是没有这个目录的，这个我们创建这个目录。</span><br><span class="line">sudo mkdir /usr/java </span><br><span class="line">2.2将jdk-7u60-linux-x64.tar.gz上传到服务器，移动到/usr/java。</span><br><span class="line">2.3解压：进入/usr/java目录（<span class="built_in">cd</span> usr/java）解压</span><br><span class="line">sudo tar -zxvfjdk-7u60-linux-x64.gz </span><br><span class="line">2.4删除jdk-7u60-linux-x64.tar.gz</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/server.html" target="_blank" rel="noopener">Server</a></p>
<h3 id="3-配置环境变量"><a href="#3-配置环境变量" class="headerlink" title="3. 配置环境变量"></a>3. 配置环境变量</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">打开/etc/profile（sudo vim /etc/profile）在最后面添加如下内容：</span><br><span class="line"><span class="built_in">export</span> JAVA_HOME=/usr/java/jdk1.7.0_60  </span><br><span class="line"><span class="built_in">export</span> JRE_HOME=/usr/java/jdk1.7.0_60/jre  </span><br><span class="line">exportCLASSPATH=.:<span class="variable">$JAVA_HOME</span>/lib/dt.jar:<span class="variable">$JAVA_HOME</span>/lib/tools.jar:<span class="variable">$JRE_HOME</span>/lib  </span><br><span class="line"><span class="built_in">export</span> PATH=<span class="variable">$PATH</span>:<span class="variable">$JAVA_HOME</span>/bin  </span><br><span class="line">让配置生效：</span><br><span class="line"></span><br><span class="line"><span class="built_in">source</span> /etc/profile</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/generating.html" target="_blank" rel="noopener">Generating</a></p>
<h3 id="4-验证"><a href="#4-验证" class="headerlink" title="4. 验证"></a>4. 验证</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">java –version  </span><br><span class="line">打印当前安装的jdk版本号java version <span class="string">"1.7.0_60"</span></span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/deployment.html" target="_blank" rel="noopener">Deployment</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2018/04/15/第二篇JDK的安装/" data-id="cjg0judjt00007komyrhi9j5m" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2018/04/15/第三篇tomcat的安装配置/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          (no title)
        
      </div>
    </a>
  
  
    <a href="/2018/04/15/hello-world/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">Hello World</div>
    </a>
  
</nav>

  
</article>

</section>
        
          <aside id="sidebar">
  
    

  
    

  
    
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/04/">April 2018</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2018/04/15/第五篇redis安装配置/">(no title)</a>
          </li>
        
          <li>
            <a href="/2018/04/15/第四篇FTP的安装配置/">(no title)</a>
          </li>
        
          <li>
            <a href="/2018/04/15/第三篇tomcat的安装配置/">(no title)</a>
          </li>
        
          <li>
            <a href="/2018/04/15/第二篇JDK的安装/">(no title)</a>
          </li>
        
          <li>
            <a href="/2018/04/15/hello-world/">Hello World</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2018 John Doe<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>



  </div>
</body>
</html>